{% extends "basic.html" %}
{% block mainbody %}
{% load mytags %}
<form id="form1" class="form-horizontal" role="form" method="POST" action="/prizecoupons/editpost/" style="padding-bottom:100px;">
  {% csrf_token %}
  
  <input type="hidden" name="id" value="{{ info.id }}"/>
  
  <div class="form-group">
    <label for="firstname" class="col-sm-2 control-label">名称</label>
    <div class="col-sm-10">
      <h5>{{ info.prize_name }}</h5>
    </div>
  </div>
  <div class="form-group">
    <label for="firstname" class="col-sm-2 control-label">金额/加息率</label>
    <div class="col-sm-10">
      <h5>{{ info.money }}{% if info.v_type == "1" %}元{% else %}%{% endif %}</h5>
    </div>
  </div>
  <div class="form-group">
    <label for="firstname" class="col-sm-2 control-label">产生奖励最高金额</label>
    <div class="col-sm-10">
      <div class="input-group">
        <span class="input-group-addon">¥</span>
        <input type="number" class="form-control" name="prize_max_money" value="{{ info.prize_max_money }}">
        <span class="input-group-addon">元</span>
      </div>
    </div>
  </div>
  <div class="form-group">
    <label for="firstname" class="col-sm-2 control-label">最大赠送人数</label>
    <div class="col-sm-10">
      <div class="input-group">
        <span class="input-group-addon"><span class="glyphicon glyphicon-user"></span></span>
        <input type="number" class="form-control" name="prize_max_money" value="{{ info.prize_max_money }}">
        <span class="input-group-addon">人</span>
      </div>
    </div>
  </div>
  
  <div class="form-group">
    <label for="firstname" class="col-sm-2 control-label">赠送开始时间</label>
    <div class="col-sm-10">
      <div class="input-group">
        <span class="input-group-addon"><span class="glyphicon glyphicon-time"></span></span>
        <input type="text" name="ttstamp~handsel_begin_dt" class="Wdate form-control" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'});document.activeElement.blur();" style="height:30px;" value="{{ info.handsel_begin_dt|timestampToDatetime }}"/>
      </div>
    </div>
  </div>
  <div class="form-group">
    <label for="firstname" class="col-sm-2 control-label">赠送结束时间</label>
    <div class="col-sm-10">
      <div class="input-group">
        <span class="input-group-addon"><span class="glyphicon glyphicon-time"></span></span>
        <input type="text" name="ttstamp~handsel_end_dt" class="Wdate form-control" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'});document.activeElement.blur();" style="height:30px;"
          {% if info.handsel_end_dt %}value="{{ info.handsel_end_dt|timestampToDatetime }}"{% else %}value=""{% endif %}/>
      </div>
    </div>
  </div>
  <div class="form-group">
    <label for="firstname" class="col-sm-2 control-label">起投金额</label>
    <div class="col-sm-10">
      <div class="input-group">
        <span class="input-group-addon">¥</span>
        <input type="number" class="form-control" name="invest_min_money" value="{{ info.invest_min_money }}">
        <span class="input-group-addon">元</span>
      </div>
    </div>
  </div>
  <div class="form-group">
    <label for="firstname" class="col-sm-2 control-label">最小投资天数</label>
    <div class="col-sm-10">
      <div class="input-group">
        <span class="input-group-addon">D</span>
        <input type="number" class="form-control" name="invest_min_duration" value="{{ info.invest_min_duration }}">
        <span class="input-group-addon">天</span>
      </div>
    </div>
  </div>
  <div class="form-group">
    <label for="firstname" class="col-sm-2 control-label">可用开始时间</label>
    <div class="col-sm-10">
      <div class="input-group">
        <span class="input-group-addon"><span class="glyphicon glyphicon-time"></span></span>
        <input type="text" name="ttstamp~available_start_dt" class="Wdate form-control" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'});document.activeElement.blur();" style="height:30px;"
          {% if info.available_start_dt %}value="{{ info.available_start_dt|timestampToDatetime }}"{% else %}value=""{% endif %}/>
      </div>
    </div>
  </div>
  <div class="form-group">
    <label for="firstname" class="col-sm-2 control-label">截止时间类型</label>
    <div class="col-sm-10">
      {% for vo in available_end_type %}
        <label class="checkbox-inline"><input type="radio" name="available_end_type" value="{{ vo.k }}" {% if vo.k == info.available_end_type|stringToInt %}checked{% endif %}>{{ vo.v }}</label>
      {% endfor %}
    </div>
  </div>
  <div class="form-group">
    <label for="firstname" class="col-sm-2 control-label">领取后有效天数</label>
    <div class="col-sm-10">
      <div class="input-group">
        <span class="input-group-addon">D</span>
        <input type="number" class="form-control" name="valid_days" value="{{ info.valid_days }}">
        <span class="input-group-addon">天</span>
      </div>
    </div>
  </div>
  <div class="form-group">
    <label for="firstname" class="col-sm-2 control-label">可用结束时间</label>
    <div class="col-sm-10">
      <div class="input-group">
        <span class="input-group-addon"><span class="glyphicon glyphicon-time"></span></span>
        <input type="text" name="ttstamp~available_end_dt" class="Wdate form-control" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'});document.activeElement.blur();" style="height:30px;"
          {% if info.available_end_dt %}value="{{ info.available_end_dt|timestampToDatetime }}"{% else %}value=""{% endif %}/>
      </div>
    </div>
  </div>
  <div class="form-group">
    <label for="firstname" class="col-sm-2 control-label">是否限制2%起投限制</label>
    <div class="col-sm-10">
      <h5>{{ info.is_limit|whetherornotToText }}</h5>
    </div>
  </div>
  <div class="form-group">
    <label for="firstname" class="col-sm-2 control-label">是否只能领取一次卡</label>
    <div class="col-sm-10">
      <h5>{{ info.is_disposable|whetherornotToText }}</h5>
    </div>
  </div>
  <div class="form-group">
    <label for="firstname" class="col-sm-2 control-label">老用户是否可领取</label>
    <div class="col-sm-10">
      <h5>{{ info.old_users_to_receive|whetherornotToText }}</h5>
    </div>
  </div>
  <div class="form-group">
    <label for="firstname" class="col-sm-2 control-label">是否启用</label>
    <div class="col-sm-10">
      {% for vo in whether_or_not %}
        <label class="checkbox-inline"><input type="radio" name="status" value="{{ vo.k }}" {% if vo.k == info.status|stringToInt %}checked{% endif %}>{{ vo.v }}</label>
      {% endfor %}
    </div>
  </div>
  
  
  <div id="btn_submit_fixed_bootom" class="form-group navbar-fixed-bottom" style="margin:5px;">
    <button type="submit" class="btn btn-primary btn-lg btn-block">提交</button>
  </div>
  <script type="text/javascript">document.write( '<style>div#btn_submit_fixed_bootom{visibility:hidden}@media(min-height:' + ($( window ).height() - 10) + 'px){div#btn_submit_fixed_bootom{visibility:visible}}</style>' );</script>
</form>
<script type="text/javascript">
$(document).ready(function(){
  //return true;
  $("#form1").submit(function(){
    var data=$(this).serialize();
    var url=$(this).attr("action");
    var tips=art.dialog.tips("正在提交……");
    
    $.ajax({
      async:false,
      type:'POST',
      url:url,
      data:data,
      success:function(rsObj){
        if(rsObj.response_code=="1"){
          art.dialog({
            content:rsObj.response_message,
            cancelVal:'继续修改',
            cancel:function(){
              tips.close();
            },
            okVal:'返回列表',
            ok:function(){
              javascript:window.history.go(-1);
            }
          });
        }else{
          art.dialog.alert(rsObj.response_message);
        }
      },
      cache:false
    });
    return false;
  });
});
</script>
{% endblock %}